#include <iostream>
using namespace std;

/*
    多重继承
        语法：class 子类 : public 父类1, public 父类2{}
    构造函数的调用顺序：
        先调用父类的构造函数，再调用子类的构造函数；父类从左到右调用
        指定父类的构造函数时，可以指定一个或者多个
        Leopard():Catamount(10),Mammal(5.0)和Leopard():Mammal(5.0),Catamount(10) ，执行的顺序不会发送改变,在继承的时候就固定好了
    析构函数的调用顺序：
        先调用子类的析构函数，再调用父类的析构函数；父类从右到左调用
*/
class Catamount
{
public:
    Catamount()
    {
        cout << "Catamount的构造函数" << endl;
    }
    Catamount(int age)
    {
        this->age = age;
        cout << "Catamount的成员变量age的值为:" << age << endl;
    }
    void run()
    {
        cout << "I am running" << endl;
    }
    ~Catamount()
    {
        cout << "Catamount的析构函数" << endl;
    }

private:
    int age;
};
class Mammal
{
public:
    Mammal()
    {
        cout << "Mammal的构造函数" << endl;
    }
    Mammal(double weight)
    {
        this->weight = weight;
        cout << "Mammal的成员变量weight的值为:" << weight << endl;
    }
    void eat()
    {
        cout << "I am eating" << endl;
    }
    ~Mammal()
    {
        cout << "Mammal的析构函数" << endl;
    }

private:
    double weight;
};
class Leopard : public Catamount, public Mammal
{
public:
    Leopard():Catamount(10),Mammal(5.0)
    {
        cout << "Leopard的构造函数" << endl;
    }
    // Leopard():Catamount(10)
    // {
    //     cout << "Leopard的构造函数" << endl;
    // }
    // Leopard():Mammal(5.0)
    // {
    //     cout << "Leopard的构造函数" << endl;
    // }
    // Leopard()
    // {
    //     cout << "Leopard的构造函数" << endl;
    // }
    void tell()
    {
        cout << "I am a leopard" << endl;
    }
    ~Leopard()
    {
        cout << "Leopard的析构函数" << endl;
    }

private:
    string name;
};

int main()
{
    Leopard leopard;
    leopard.run();
    leopard.eat();
    leopard.tell();

    cout << "--------------------------------------------------" << endl;
    // Leopard l1;


    return 0;
}